#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	FILE* ch = fopen("test3.txt", "w");
	srand(time(NULL));
	int arr[5] = { 0 };
	for (int i = 0; i < 5; i++) {
		int a = rand() % 100;
		fprintf(ch, "%d ", a);
		printf("%d ", a);
		arr[i] = a;
	}
	fclose(ch);
	for (int i = 0,j = 0; i < 5; i++) {
		for (j = 0; j < 5 - 1 - i; j++) {
			if (arr[j] > arr[j + 1]) {
				int b = arr[j];
				arr[j] = arr[j + 1];
				arr[j + 1] = b;
			}
		}
	}
	ch = fopen("test3.txt", "a");
	printf("\n");
	fprintf(ch, "\n");
	for (int n = 0; n < 5; n++) {
		fprintf(ch, "%d ", arr[n]);
		printf("%d ", arr[n]);
	}
	fclose(ch);
	return 0;
}